package com.wanxi.array.filter;

import com.wanxi.array.Student;

import java.util.ArrayList;

public class FilterStudent {
    public static void main(String[] args) {
        ArrayList<Student> arrayList = new ArrayList<>();
        arrayList.add(new Student("1", 22));
        arrayList.add(new Student("2", 16));
        arrayList.add(new Student("3", 19));
        arrayList.add(new Student("4", 23));
        arrayList.add(new Student("5", 26));
        ArrayList<Student> arr = new ArrayList<>();
        for (int i = 0; i < arrayList.size(); i++) {
            if(arrayList.get(i).getAge()>=20){
                arr.add(arrayList.get(i));
            }
        }
        System.out.println(arr);
    }
}
